package cn.gene.timeyan.search.webapi.repository;

import cn.gene.timeyan.pojo.search.entity.CooperationForElastic;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;


/**
 * 失物招领*
 *
 * @author LWG
 * @date 2022/8/6 19:25
 * @since 1.0.0 @gene.cn
 */
public interface LostRepository extends ElasticsearchRepository<CooperationForElastic, Long> {
    // 所有更新数据的操作都由Logstash负责,这里无需编写数据更新代码
    @Query("{\n" +
            "    \"bool\": {\n" +
            "      \"should\": [\n" +
            "        { \"match\": { \"help_title\": \"?0\"}},\n" +
            "        { \"match\": { \"help_content\": \"?0\"}}\n" +
            "        ]\n" +
            "     }\n" +
            "}")
//Iterable<CooperationForElastic> querySearch(String keyword);
    Page<CooperationForElastic> querySearchLost(String keyword, Pageable pageable);
}
